//
// Decompiled by Jadx - 360ms
//
package gf;

import a.g;
import a.i;
import android.content.Context;
import android.content.Intent;
import de.robv.android.xposed.XposedHelpers;
import fn.b;
import fn.j;
import fn.x;
import fn.y;
import fo.c;
import java.util.Iterator;
import me.plusne.GreenDao.dao.RecordLogDao;
import me.plusne.common.Json.JsonHookStatic;
import o.a;
import org.luckypray.dexkit.query.matchers.ClassMatcher;

@a("WX")
public final class k extends x {
    public static final int cp = 0;

    public static boolean cq(String str) {
        if (cu()) {
            return y.ch(str, false);
        }
        return false;
    }

    public static void cr() {
        boolean z;
        if (h.cp != null && y.ch("secretFriend_finish", false)) {
            String str = (String) j.ab(h.cp, "getStringExtra", new Object[]{"Chat_User"});
            if (cu() && b.e(691, str) != null) {
                z = true;
            } else {
                z = false;
            }
            if (z) {
                try {
                    XposedHelpers.callMethod(h.cp, "finish", new Object[0]);
                } catch (XposedHelpers.InvocationTargetError e) {
                    e.printStackTrace();
                }
            }
        }
        JsonHookStatic jsonHookStatic = y.by;
        RecordLogDao recordLogDao = jsonHookStatic.getDb().v;
        g o = androidx.activity.b.o(recordLogDao, recordLogDao);
        o.l(RecordLogDao.Properties.Type.f(691), new i[0]);
        Iterator it = o.j().iterator();
        while (it.hasNext()) {
            fm.i iVar = (fm.i) it.next();
            if (iVar.c.equals("0")) {
                p.cs = true;
                ab.cy(iVar.b);
                iVar.c = "1";
                jsonHookStatic.getDb().l(iVar);
            }
        }
        ab.cx();
    }

    public static void cs() {
        JsonHookStatic jsonHookStatic = y.by;
        RecordLogDao recordLogDao = jsonHookStatic.getDb().v;
        g o = androidx.activity.b.o(recordLogDao, recordLogDao);
        o.l(RecordLogDao.Properties.Type.f(691), new i[0]);
        Iterator it = o.j().iterator();
        while (it.hasNext()) {
            fm.i iVar = (fm.i) it.next();
            if (iVar.c.equals("0")) {
                ab.cy(iVar.b);
            }
            iVar.c = "1";
            jsonHookStatic.getDb().l(iVar);
        }
    }

    public static boolean ct(String str) {
        fm.i e;
        if (!cu() || (e = b.e(691, str)) == null || !e.c.equals("1")) {
            return false;
        }
        return true;
    }

    public static boolean cu() {
        return y.ch("secretFriend_open", false);
    }

    public static void cv() {
        JsonHookStatic jsonHookStatic = y.by;
        RecordLogDao recordLogDao = jsonHookStatic.getDb().v;
        g o = androidx.activity.b.o(recordLogDao, recordLogDao);
        o.l(RecordLogDao.Properties.Type.f(691), new i[0]);
        Iterator it = o.j().iterator();
        while (it.hasNext()) {
            fm.i iVar = (fm.i) it.next();
            if (iVar.c.equals("1")) {
                ab.cy(iVar.b);
            }
            iVar.c = "0";
            jsonHookStatic.getDb().l(iVar);
        }
    }

    public final void a() {
        if (y.by.isLoadAllUserData()) {
            j.bd(c.n(ClassMatcher.create().usingStrings(new String[]{"iLink onAppBackground:", "MicroMsg.ILinkInitMgr"})).getName(), "onAppBackground", new Object[]{String.class, new a()});
            j.bd("com.tencent.mm.ui.LauncherUI", "onPause", new Object[]{new b()});
            j.bd(c.n(ClassMatcher.create().usingStrings(new String[]{"MicroMsg.AppForegroundDelegate", "ACTION_SCREEN:%s isAppForeground:%s"})).getName(), "onReceive", new Object[]{Context.class, Intent.class, new c()});
        }
    }
}
